-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: code coverage incomplete on redirect #660
fix: code coverage incomplete on redirect #660
Conversation
.nycrc.json
Outdated
@@ -1,6 +1,7 @@ | |||
{ | |||
"exclude": [ | |||
"support-utils.js", | |||
"task-utils.js" | |||
"task-utils.js", | |||
"support.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this being excluded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you run the unit-tests, support.js is reported as having too little coverage, but support.js is not even being tested (only support-utils.js). I thought that this is an issue with my code, but I get the same result on the main branch.
Co-authored-by: Matt Schile <[email protected]>
@mschile , @cacieprins This MR has been hanging around for almost 4 months. Is there something I can do to get this merged? |
Hi @fvclaus 👋, sorry for the delay. I will try to get back to this very soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fvclaus Nice job tracking down the root-cause of this issues. We appreciate the contribution!
🎉 This PR is included in version 3.12.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
We have a frontend that, upon loading, redirects the user to Keycloak. The user logs in and is returned to the application. The code coverage written to the disk was incomplete and after hours of debugging I found the issue. The problem is the caching of references to the
window.__coverage__
object. When the code that redirects the user is instrumented, the covered statements will be different for the initial redirect and the subsequent return so this plugin will correctly recognize them as different and will keep a reference to both coverage objects. When the code that redirects the user is not instrumented (because it is a library), the coverage object will be identical. Both coverage objects will have identical statement coverage and the current version of the code will throw away the second coverage object, keeping only the reference to the first one which is not updated anymore. This will result in a code coverage where only the statments until the call to the library are covered.Before:
After:
Keywords for Google: Code coverage different in
afterEach
.